package com.sx.gongzhong.pest;

import android.content.Context;

import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.LegalAdviceBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.model.BasePageListBean;
import com.sx.gongzhong.net.LegalAdviceManager;
import com.sx.gongzhong.view.LegalAdviceListView;

import java.util.Map;

/**法律咨询 列表
 * Created by admin on 2018/1/12.
 */

public class LegalAdviceListPest {
    private LegalAdviceListView legalAdviceListView;

    public LegalAdviceListPest(LegalAdviceListView legalAdviceListView) {
        this.legalAdviceListView = legalAdviceListView;
    }
    public void getLegalAdviceListData(Context context, int page, int rows) {
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("sourcesState",0);
        map.put("page",page);
        map.put("rows",rows);
        new LegalAdviceManager().getLegalAdviceListData(map, new BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<LegalAdviceBean>>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<BasePageListBean<LegalAdviceBean>> response) {
                legalAdviceListView.getSuccess(response.data.rows,response.data.total);
            }
            @Override
            public void onFailures(String message) {
                legalAdviceListView.showError(message);
            }
        });
    }

}
